Class symantec.itools.awt.FormattedTextField
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.FormattedTextField

Object
   |
   +----Component
           |
           +----TextComponent
                   |
                   +----TextField
                           |
                           +----symantec.itools.awt.FormattedTextField

public class FormattedTextField
extends TextField
Creates a box in which the user can type text. Text formatting logic is applied to the user input.

Use FormattedTextField to

If the text box already contains text, the user can select the default text and delete or edit it.

Version:
1.1, August 30, 1997
Author:
Symantec

Variable Index

 o ALPHANUMERIC_LOWER
Character mask constant, input must be a digit or a lowercase alpha character.
 o ALPHANUMERIC_TO_LOWER
Character mask constant, input must be a digit or alpha character (it will be converted to lowercase).
 o ALPHANUMERIC_TO_UPPER
Character mask constant, input must be a digit or alpha character (it will be converted to uppercase).
 o ALPHANUMERIC_UPPER
Character mask constant, input must be a digit or an uppercase alpha character.
 o ALPHA_LOWER
Character mask constant, input must be a lowercase alpha character.
 o ALPHA_TO_LOWER
Character mask constant, input must be an alpha character (it will be converted to lowercase).
 o ALPHA_TO_UPPER
Character mask constant, input must be an alpha character (it will be converted to uppercase).
 o ALPHA_UPPER
Character mask constant, input must be an uppercase alpha character.
 o ANY
Character mask constant, input can be any character.
 o BACKSPACE
Character constant, the backspace character.
 o DEL
Character constant, the delete character.
 o DIGIT
Character mask constant, input must be a digit character.
 o DIGIT_OR_SIGN
Character mask constant, input must be a digit or sign (+ or -) character.
 o ENTER
Character constant, the enter character.
 o ESCAPE
Character mask constant, the character following this ESCAPE will be placed into input string.
 o SIGN
Character mask constant, input must be a sign (+ or -) character.
 o caret
The zero-relative index of the character after the insertion point caret.
 o designTimeText
The string passed to setText at design time.
 o mask
The valid string format mask used to define legal field input.
 o maskStripEscapes
A string containing all the mask string characters except the ones immediately after ESCAPE characters.
 o maskStripEscapesLen
The length of maskStripEscapes.
 o unformattedCurrent
The valid characters currently in the textfield, with no formatting.

Constructor Index

 o symantec.itools.awt.FormattedTextField()
Constructs a new FormattedTextField.
 o symantec.itools.awt.FormattedTextField(int)
Constructs a new FormattedTextField with the specified number of columns.
 o symantec.itools.awt.FormattedTextField(String)
Constructs a new FormattedTextField containing the specified text.
 o symantec.itools.awt.FormattedTextField(String, int)
Constructs a new FormattedTextField containing the specified text and able to have the specified number of columns.

Method Index

 o addNotify()
Tells this component that it has been added to a container.
 o applyMask(String)
Returns a formatted string, given an input string and the current valid string format mask.
 o applyMaskToChar(char, int)
Apply the mask at index to the given character.
 o countNonEscapeChars(int, int)
Counts the possible number of non-escape characters before the given index.
 o filterChar(char, char)
Filters the given target character with the given mask character
 o getEditFont()
 o getFormattedText()
Gets the displayed contents of the component.
 o getMask()
Gets the current valid string format mask.
 o getMaskTemplateString()
Returns a string defining an input template.
 o getMinimumSize()
Returns the minimum dimensions to properly display this component.
 o getPreferredSize()
Returns the recommended dimensions to properly display this component.
 o getText()
Gets the unformatted string of filtered characters.
 o minimumSize()
 o preferredSize()
 o processChar(int)
Handles KEY_PRESS processing.
 o removeNotify()
Tells this component that it is being removed from a container.
 o setEditFont(Font)
 o setEditable(boolean)
Sets whether the text field is editable.
 o setFillMask()
Clears the contents of the field and sets the text field's contents to be an input template.
 o setMask(String)
Sets the valid string format mask for this field.
 o setText(String)
Sets the text of this TextComponent to the specified text after passing the specified text throught the filter.
 o stripMask(String)
Strips escape characters from the given string.
 o validChar(String, int, char)
Returns the next valid character in the input string.

Variables

 o ALPHANUMERIC_LOWER
public final char ALPHANUMERIC_LOWER
Character mask constant, input must be a digit or a lowercase alpha character.

 o ALPHANUMERIC_TO_LOWER
public final char ALPHANUMERIC_TO_LOWER
Character mask constant, input must be a digit or alpha character (it will be converted to lowercase).

 o ALPHANUMERIC_TO_UPPER
public final char ALPHANUMERIC_TO_UPPER
Character mask constant, input must be a digit or alpha character (it will be converted to uppercase).

 o ALPHANUMERIC_UPPER
public final char ALPHANUMERIC_UPPER
Character mask constant, input must be a digit or an uppercase alpha character.

 o ALPHA_LOWER
public final char ALPHA_LOWER
Character mask constant, input must be a lowercase alpha character.

 o ALPHA_TO_LOWER
public final char ALPHA_TO_LOWER
Character mask constant, input must be an alpha character (it will be converted to lowercase).

 o ALPHA_TO_UPPER
public final char ALPHA_TO_UPPER
Character mask constant, input must be an alpha character (it will be converted to uppercase).

 o ALPHA_UPPER
public final char ALPHA_UPPER
Character mask constant, input must be an uppercase alpha character.

 o ANY
public final char ANY
Character mask constant, input can be any character.

 o BACKSPACE
protected final int BACKSPACE
Character constant, the backspace character.

 o DEL
protected final int DEL
Character constant, the delete character.

 o DIGIT
public final char DIGIT
Character mask constant, input must be a digit character.

 o DIGIT_OR_SIGN
public final char DIGIT_OR_SIGN
Character mask constant, input must be a digit or sign (+ or -) character.

 o ENTER
protected final int ENTER
Character constant, the enter character.

 o ESCAPE
public final char ESCAPE
Character mask constant, the character following this ESCAPE will be placed into input string.

 o SIGN
public final char SIGN
Character mask constant, input must be a sign (+ or -) character.

 o caret
protected int caret
The zero-relative index of the character after the insertion point caret.

 o designTimeText
protected java.lang.String designTimeText
The string passed to setText at design time. Returned from getText at design time.

 o mask
protected java.lang.String mask
The valid string format mask used to define legal field input.

 o maskStripEscapes
protected java.lang.String maskStripEscapes
A string containing all the mask string characters except the ones immediately after ESCAPE characters.

 o maskStripEscapesLen
protected int maskStripEscapesLen
The length of maskStripEscapes.

 o unformattedCurrent
protected java.lang.String unformattedCurrent
The valid characters currently in the textfield, with no formatting.

Constructors

 o FormattedTextField
public FormattedTextField()
Constructs a new FormattedTextField. It can have 256 columns.

 o FormattedTextField
public FormattedTextField(int i)
Constructs a new FormattedTextField with the specified number of columns.

Parameters:
i - the number of character columns
 o FormattedTextField
public FormattedTextField(String s)
Constructs a new FormattedTextField containing the specified text. It can have 256 columns.

Parameters:
s - the field text
 o FormattedTextField
public FormattedTextField(String s,
                          int i)
Constructs a new FormattedTextField containing the specified text and able to have the specified number of columns.

Parameters:
s - the field text
i - the number of character columns

Methods

 o addNotify
public synchronized void addNotify()
Tells this component that it has been added to a container. This is a standard Java AWT method which gets called by the AWT when this component is added to a container. Typically, it is used to create this component's peer. It has been overridden here to call addKeyListener.

Overrides:
addNotify in class TextField
See Also:
removeNotify
 o applyMask
protected java.lang.String applyMask(String s)
Returns a formatted string, given an input string and the current valid string format mask.

Parameters:
s - the input string
Returns:
the input string formatted using the current valid string format mask.
 o applyMaskToChar
protected java.lang.String applyMaskToChar(char targetChar,
                                           int index)
Apply the mask at index to the given character.

Parameters:
char - targetChar the character to apply the mask to.
int - index the index in the mask to use on the given character.
Returns:
A string with the given character with the mask at the given index applied. An empty string if the character was invalid or if the given index was an escape character index.
 o countNonEscapeChars
protected int countNonEscapeChars(int start,
                                  int beforeIndex)
Counts the possible number of non-escape characters before the given index.

Parameters:
int - start the index in the mask template to start from. Inclusive.
int - beforeIndex the index in the mask template to count back from. Exclusive.
Returns:
int the number of possible non-escape characters allowed before the given index.
 o filterChar
protected char filterChar(char targetChar,
                          char maskChar)
Filters the given target character with the given mask character

Parameters:
char - targetChar the character to apply the filter to.
char - maskChar the character to use as a filter. Should match one of the pre-defined types.
See Also:
applyMask, applyMaskToChar, ALPHA_TO_UPPER, ALPHA_TO_LOWER, ALPHANUMERIC_TO_UPPER, ALPHANUMERIC_TO_LOWER
 o getEditFont
public java.awt.Font getEditFont()
Note: getEditFont() is deprecated.

 o getFormattedText
public java.lang.String getFormattedText()
Gets the displayed contents of the component.

Returns:
the string currently displayed by the component.
See Also:
setText, getText
 o getMask
public java.lang.String getMask()
Gets the current valid string format mask.

Returns:
the string that defines valid input into this field.
See Also:
setMask
 o getMaskTemplateString
public java.lang.String getMaskTemplateString()
Returns a string defining an input template. The mask ESCAPE characters will be place in the string. All other mask characters will have spaces in place of them. For example, a mask of "99/-9/-9" results in a string set to " - - ".

Returns:
the template string defined by the mask, with spaces as placeholders.
 o getMinimumSize
public java.awt.Dimension getMinimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
getMinimumSize in class TextField
See Also:
getPreferredSize
 o getPreferredSize
public java.awt.Dimension getPreferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
getPreferredSize in class TextField
See Also:
getMinimumSize
 o getText
public java.lang.String getText()
Gets the unformatted string of filtered characters.

Returns:
the string of unformatted characters that were accepted by the mask filtering process. At design time this returns the text passed to setText.
Overrides:
getText in class TextComponent
See Also:
setText, getFormattedText
 o minimumSize
public java.awt.Dimension minimumSize()
Note: minimumSize() is deprecated. As of JDK version 1.1, replaced by getMinimumSize().

Overrides:
minimumSize in class TextField
 o preferredSize
public java.awt.Dimension preferredSize()
Note: preferredSize() is deprecated. As of JDK version 1.1, replaced by getPreferredSize().

Overrides:
preferredSize in class TextField
 o processChar
protected void processChar(int key)
Handles KEY_PRESS processing.

Parameters:
int - the key that was pressed
 o removeNotify
public synchronized void removeNotify()
Tells this component that it is being removed from a container. This is a standard Java AWT method which gets called by the AWT when this component is removed from a container. Typically, it is used to destroy the peers of this component and all its subcomponents. It has been overridden here to call removeKeyListener.

Overrides:
removeNotify in class TextComponent
See Also:
addNotify
 o setEditFont
public void setEditFont(Font f)
Note: setEditFont() is deprecated.

 o setEditable
public void setEditable(boolean f)
Sets whether the text field is editable.

Parameters:
f - true if the text field is editable, false otherwise
Overrides:
setEditable in class TextComponent
See Also:
isEditable
 o setFillMask
public void setFillMask()
Clears the contents of the field and sets the text field's contents to be an input template. The mask ESCAPE characters will be place in the field. All other mask characters will have spaces in place of them. For example, a mask of "99/-9/-9" results in the text field getting set to " - - ".

 o setMask
public void setMask(String mask)
Sets the valid string format mask for this field.

Parameters:
mask - the new valid string format mask
See Also:
getMask
 o setText
public void setText(String t)
Sets the text of this TextComponent to the specified text after passing the specified text throught the filter.

Parameters:
t - the new text to be set
Overrides:
setText in class TextComponent
See Also:
getText
 o stripMask
protected java.lang.String stripMask(String s)
Strips escape characters from the given string. For example, a mask of "99/-9/-9" and an input string of "12-3-4" results in "1234".

Parameters:
s - the input string
Returns:
the input string stripped of mask escape characters.
 o validChar
protected int validChar(String s,
                        int start,
                        char maskChar)
Returns the next valid character in the input string.

Parameters:
s - the input string
start - the zero-relative index of the first character to check in the input string
maskChar - the mask character used to determine which input characters are valid

All Packages  Class Hierarchy  This Package  Previous  Next  Index